const mqtt = require("mqtt");
const client = mqtt.connect("mqtt://box.anzhitek.com:8081",{   //  ;175.27.190.12 ；139.224.131.108
  username: "jyq",
  password: "810302",
}); //连接到mqtt服务端,用户名和密码在emqx平台设置，
//写个定时器定时每隔3秒定时推送天气信息，此业务可替换为自己的实际需求
// var iconv = require('iconv-lite');
// setInterval(function () {
  // buffer = iconv.encode('油漆房1,气体传感器','gbk') // 
  const buffer = "87225043,1,08030001000101c2,0303000000010014,0403000000010014"; //char mqtt_str[] = "47587974,08030004,0001012c,03030000,00010014";    0x08,0x03,0x00,0x01,0x00,0x01,0xD5,0x53} 02030000,00010014,
  // const buffer = "43241929,2,0110";
  // const buffer = str + '\n'; 
  //57222343,08030001,0001015e,02030000,00010014,{0x07,0x03,0x00,0x00,0x00,0x01,0x84,0x6C 07030000，000100D1
  client.publish("sensorWriter", buffer, { qos: 0, retain: true }); //anzhitekALARM  box.anzhitek.com
// }, 300);

